<?php

class AcceptMethodsAttribute extends AttributeBase {
	
	function __construct($param) {
		parent::__construct($param);
	}
	
	public function process() {
		
		$acceptMethods = split(',', $this->param);
		$return = false;
		
		foreach ($acceptMethods as $acceptMethod) {
			if (strtolower($_SERVER['REQUEST_METHOD']) == $acceptMethod) {
				$return = true;
			}
		} 
		
		if (!$return) {
			$response = new Response();
			$response->send405();
		}
		
		return $return;
	} 
}

?>